#!/bin/bash
cd /home/sonia/workspace/sanitas-crm
echo `date`
./symfony project:send-emails --env=prod --application=frontend --message-limit=20 --time-limit=200 > exit.txt
echo `tail exit.txt`
enviados=$(cat exit.txt | awk '{ print $4 }')
while [ "$enviados" -gt "0" ]; do
    ./symfony project:send-emails --env=prod --application=frontend --message-limit=20 --time-limit=200 > exit.txt
    #Esperamos un poco
    sleep 100
    echo "dormido100 \n" 
    echo `tail exit.txt` 
    enviados=$(cat exit.txt | awk '{ print $4 }')
done